package edu.sctu.practice.class01.nieyu.assign02.test_2_rational;

/**
 * Created by Administrator on 2015/10/8.
 */
public class Rational {

    private long number; //����1��
    private long number1;//����2��

    public Rational(long number, long number1) {

        this.number = number;
        this.number1 = number1;
    }

    /**
     * �ӷ�����
     *
     * @return
     */
    public long add() {

        long resultOfAdd = number + number1;
        return resultOfAdd;
    }

    /**
     * ��������
     *
     * @return
     */
    public long subtract() {

        long resultOfSubtract = number - number1;
        return resultOfSubtract;
    }

    /**
     * �˷�����
     *
     * @return
     */
    public long multiplication() {

        long resultOfMutiplication = number * number1;
        return resultOfMutiplication;
    }

    /**
     * ��������
     *
     * @return
     */
    public long divide() {

        long resultOfDivide = 0;
        if (number != 0) {
            resultOfDivide = number1 / number;
        } else if (number1 != 0) {
            resultOfDivide = number / number1;
        } else {
            System.out.println("��ĸ����Ϊ0��");
        }
        return resultOfDivide;
    }
}
